<?php
header("Content-type: text/html; charset=gb2312");

$file = "./source/minecraft.path";
if(file_exists($file)){
$str = file_get_contents($file);
$str = str_replace("\r\n","<br />",$str);
}
$file_path = $str."/server.properties";
$strs = parse_ini_file($file_path);

$file = "./source/default/set.htm";
if(file_exists($file)){
$str = file_get_contents($file);
$str = str_replace("\r\n","<br />",$str);
}
$str = str_replace("{server-name}",$strs['server-name'],$str);
$str = str_replace("{gamemode}",$strs['gamemode'],$str);
$str = str_replace("{difficulty}",$strs['difficulty'],$str);
$str = str_replace("{max-players}",$strs['max-players'],$str);
$str = str_replace("{server-port}",$strs['server-port'],$str);
$str = str_replace("{server-portv6}",$strs['server-portv6'],$str);
$str = str_replace("{view-distance}",$strs['view-distance'],$str);
$str = str_replace("{tick-distance}",$strs['tick-distance'],$str);
$str = str_replace("{player-idle-timeout}",$strs['player-idle-timeout'],$str);
$str = str_replace("{max-threads}",$strs['max-threads'],$str);
$str = str_replace("{level-name}",$strs['level-name'],$str);
$str = str_replace("{level-seed}",$strs['level-seed'],$str);
$str = str_replace("{default-player-permission-level}",$strs['default-player-permission-level'],$str);

if($strs['force-gamemode'] == "1"){
$str = str_replace("{force-gamemode}","true",$str);
}else{
$str = str_replace("{force-gamemode}","false",$str);
}

if($strs['allow-cheats'] == "1"){
$str = str_replace("{allow-cheats}","true",$str);
}else{
$str = str_replace("{allow-cheats}","false",$str);
}

if($strs['online-mode'] == "1"){
$str = str_replace("{online-mode}","true",$str);
}else{
$str = str_replace("{online-mode}","false",$str);
}

if($strs['allow-list'] == "1"){
$str = str_replace("{allow-list}","true",$str);
}else{
$str = str_replace("{allow-list}","false",$str);
}

if($strs['texturepack-required'] == "1"){
$str = str_replace("{texturepack-required}","true",$str);
}else{
$str = str_replace("{texturepack-required}","false",$str);
}

if($strs['content-log-file-enabled'] == "1"){
$str = str_replace("{content-log-file-enabled}","true",$str);
}else{
$str = str_replace("{content-log-file-enabled}","false",$str);
}


$str2 = "var d = d + '<br/>compression-threshold=".$strs['compression-threshold'];
$str2 = $str2.'<br/>server-authoritative-movement='.$strs['server-authoritative-movement'];
$str2 = $str2.'<br/>player-movement-score-threshold='.$strs['player-movement-score-threshold'];
$str2 = $str2.'<br/>player-movement-action-direction-threshold='.$strs['player-movement-action-direction-threshold'];
$str2 = $str2.'<br/>player-movement-distance-threshold='.$strs['player-movement-distance-threshold'];
$str2 = $str2.'<br/>player-movement-duration-threshold-in-ms='.$strs['player-movement-duration-threshold-in-ms'];

if($strs['correct-player-movement'] == "1"){
$str2 = $str2.'<br/>correct-player-movement=true';
}else{
$str2 = $str2.'<br/>correct-player-movement=false';
}

if($strs['server-authoritative-block-breaking'] == "1"){
$str2 = $str2."<br/>server-authoritative-block-breaking=true'";
}else{
$str2 = $str2."<br/>server-authoritative-block-breaking=false';";
}
$str = str_replace("{script}",$str2,$str);
echo $str;
?>